Skip to content

perf(release): speed up pytest discovery, live portfolio default concurrency, and sharded qualification - #9193

Merged
loopx-agent merged 2 commits into
mainfrom
codex/perf-release-qualification-20261121
Nov 21, 2026
Merged

loopx-agent merged 2 commits into
mainfrom
codex/perf-release-qualification-20261121

Conversation

@loopx-agent

Copy link
Copy Markdown
Collaborator

Delivery Brief

  • Goal / source: Reduce LoopX release qualification wall-clock time without weakening test coverage, source identity checks, or isolation guarantees.
  • Root bottlenecks measured during v2.4.0 qualification:
    1. Custom norecursedirs in pyproject.toml omitted pytest defaults (.*, *.egg, node_modules, venv), forcing every pytest startup and shard to traverse .venv/, node_modules/, and .git/ (29.56s vs 7.33s when node_modules/.venv are present in a full release checkout — 4.03× slower collection for identical 41,648 tests).
    2. scripts/qualify-doubao-model-behavior-live.py defaulted --max-workers to 1 (>40 min serial across 44 Ark API actor calls + 6 contrasts vs 426.39s at --max-workers 6).
    3. Full release pytest relied on ad-hoc shard scripts defaulting to 6 workers (6,586s) or 2-wave 16/8 scheduling (5,173s) without shipped changed-file preflight, selection-bound exact-source --resume, or automated JUnit XML -> receipt-pytest.json reduction.
  • Changes implemented:
    • pyproject.toml ([tool.pytest.ini_options].norecursedirs): add ".*", "*.egg", "node_modules", "venv" alongside LoopX's existing exclusions.
    • scripts/qualify-doubao-model-behavior-live.py: raise --max-workers default from 1 to 6 (--max-workers 1 remains explicitly selectable).
    • scripts/qualify_release_commit.py + docs/product/release-readiness.md: ship an isolated, clean-checkout-enforced qualification runner with --preflight-since changed-test preflight, hardware-sized single-wave shard concurrency (default_pytest_parallelism, 2/3 CPUs capped at 12), safe per-shard duration merging, fail-closed exact (git_commit, git_tree, git_dirty=False, selection_fingerprint) --resume, disposable runtime teardown in finally:, and zero-local-path receipt-pytest.json reduction.
    • tests/control_plane/test_release_commit_qualification.py: unit & clean-repo end-to-end coverage for norecursedirs, --max-workers default/override, default_pytest_parallelism, preflight selection, selection-bound --resume guards, and JUnit XML -> exact_release_check_receipt_v0 validation.
  • Owning boundary: Release qualification tooling, pytest discovery config, and release readiness docs.
  • Verification (local, exact commit):
    • pytest (test_release_commit_qualification.py, test_actual_default_model_behavior_live.py, test_python_ci_workflow.py): 574 passed in 34.79s
    • examples/release/exact-release-commit-qualification-smoke.py: PASS
    • examples/release/release-readiness-doc-smoke.py: PASS
    • ruff check, mypy (17 files), check_rfc_bilingual.py, loopx check --scan-path ... (0 errors): PASS

…urrency, and sharded qualification

Signed-off-by: LoopX Agent <[email protected]>
@loopx-agent
loopx-agent force-pushed the codex/perf-release-qualification-20261121 branch from af3ce0f to 9f9c7dd Compare November 21, 2026 13:12

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent · Gemini · Google · self_reported

Request changes conclusion (author-owned PR; GitHub blocks formal self-review)

在精确 head 9f9c7ddc453f866acf3c8f9ee8223c5d1924fb1f 上复核了全部 6 个改动文件并独立执行了测试、smoke、静态检查与反事实实验:核心包发现配置与并发默认值方向正确,但新增的 scripts/qualify_release_commit.py 在实测中暴露出 3 个阻断性缺陷(P1) 与 1 个参数校验遗漏(P2),导致当前版本下按 docs/product/release-readiness.md 文档示例直接运行会失败或写坏耗时缓存。

动机 / Motivation

发布维护者在执行 v2.4.0 全量发版验收时,需要依次完成 pytest 发现、全套分片测试以及真实模型行为评估。改动前,自定义 norecursedirs 漏掉了 .* 和 node_modules 导致 pytest 启动遍历虚拟环境和依赖目录,真实模型脚本默认单并发耗时较长,且缺乏统一的干净检出分片与回执归约脚本;改动后补全了 norecursedirs、将并发默认值设为 6,并新增 scripts/qualify_release_commit.py 执行变更预检、单波分片和 JUnit 回执归约。在干净工作树上,pytest --collect-only 保持 41,664 条核心用例不变,qualify-doubao-model-behavior-live.py 默认 --max-workers 为 6 并保留 --max-workers 1,qualify_release_commit.py 可对干净仓库生成不含本地路径的 exact_release_check_receipt_v0 回执;但实测表明在当前精确 head 上直接运行文档给出的 --preflight-since v2.3.0 命令会因选入可选扩展测试而收集报错退出,--durations-path 与 --durations-out 同用会回写陈旧耗时,且目录清理使用了 Python 3.12 才提供的 onexc 参数而在 Python 3.11 上直接报错。本 PR 不修改核心控制面语义、不自动触发外部模型或发版推广,也不取代独立的可选 provider 工作流。在未修复前,仍需在预检筛选中排除 norecursedirs 覆盖的可选 provider 测试目录、修复 --durations-out 合并时的陈旧耗时覆盖、使临时目录清理兼容 declared >=3.11 的 Python 3.11,并拦截缺少 --preflight-since 的 --only-preflight 调用。

改动思路 / Approach

将发现目录排除保留在 pyproject.toml、默认并发保留在 scripts/qualify-doubao-model-behavior-live.py、并将干净检出预检与分片编排收敛到独立脚本 scripts/qualify_release_commit.py 的所有权划分是清晰的,核心问题在于该脚本内部存在三处会破坏文档主路径与声明运行时兼容性的实现缺陷。当前 PR 边界限定在发版工程工具链、pytest 配置和发版说明文档,复用现有的 exact_release_check_receipt_v0 契约、collect_release_source_identity、stop_disposable_effect_runtimes 与 CI 时序/分片插件,不引入新的核心协议字段或控制面状态。

flowchart TD
    A["qualify_release_commit.py (9f9c7ddc45)"] --> B{"干净检出校验 git_dirty==false"}
    B -- "脏工作树" --> B1["FAIL-CLOSED: RuntimeError 拒绝执行"]
    B -- "干净" --> C{"--preflight-since 指定?"}
    C -- "v2.3.0..HEAD" --> D["select_preflight_tests 误选 packages/loopx-ark-turn"]
    D --> D1["PASS? 实测 exit_code=2 (缺 arkruntime)"]
    C -- "跳过或命中" --> E["ThreadPoolExecutor 单波并行分片 (默认 2/3 CPU 上限 12)"]
    E --> F["--durations-path 拷贝到各分片 + --store-durations (缺 --clean-durations)"]
    F --> G["_merge_shard_durations 按完成顺序覆盖 -> 旧耗时反写新结果"]
    E --> H["_remove_tree_tolerant(..., onexc=...)"]
    H --> H1["Python 3.11 TypeError"]
Loading

图示基于精确 head 9f9c7ddc453f866acf3c8f9ee8223c5d1924fb1f 源码与本地反事实执行整理,仅用于说明控制流与失败分支。

关注面 基线行为 (869de8599d) 当前 head (9f9c7ddc45) 独立验证结论
pyproject.toml norecursedirs 仅列 6 个目录,未包含 .*/node_modules/venv 补齐 .*、*.egg、node_modules、venv 保持 41664 条核心测试不变 (PASS)
qualify-doubao-model-behavior-live.py --max-workers 默认 1 --max-workers 默认 6,保留 1 覆盖 单测覆盖默认 6 与显式 1 (PASS)
qualify_release_commit.py 预检 无统一脚本 --preflight-since + select_preflight_tests --preflight-since v2.3.0 收集报错 exit_code=2 (FAIL)
qualify_release_commit.py 耗时合并 无统一脚本 --durations-path + --durations-out test_a 被另一分片旧拷贝覆写回 99.0s (FAIL)
qualify_release_commit.py 清理 无统一脚本 shutil.rmtree(..., onexc=...) Python 3.11.17 实测 TypeError (FAIL)

具体改动 / Changes

依据发版契约规范 docs/product/release-readiness.md(基线修订 869de8599ddf32f4cd03b32bfb0992794973f95f):

  • REL-QUAL-1(干净来源身份与零本地路径 exact_release_check_receipt_v0 回执生成):implemented(通过 collect_release_source_identity 与 receipt-pytest.json 生成及 exact-release-commit-qualification-smoke.py 验证)。
  • REL-QUAL-2(文档化的 --preflight-since v2.3.0 预检与 --durations-path / --durations-out 增量分片工作流在候选提交上可执行且不污染缓存):not_met(当前 head 上实测 --preflight-since v2.3.0 收集失败,且 --durations-out 会被旧耗时反向覆盖)。
  • REL-QUAL-3(核心 pytest 发现隔离可选 provider 套件且工具兼容 requires-python = ">=3.11"):not_met(pyproject.toml 核心发现保持 41664 条测试不变,但 scripts/qualify_release_commit.py 中 _remove_tree_tolerant 在 Python 3.11 上直接 TypeError)。
  • REL-QUAL-4(v2.4.0.md 双语发版说明与 release-readiness-doc-smoke.py 13 项可选能力校验):implemented(13 个 --surface 全部校验通过)。

关键代码讲解

  1. scripts/qualify_release_commit.py — _is_direct_test_path 与 select_preflight_tests(L165-225):根据 git diff --name-only <ref>..HEAD 把改动映射到直跑测试文件与关联高信号测试。问题在于 _is_direct_test_path 允许所有 packages/ 下以 test_ 开头或 _test.py 结尾的文件直接进入 pytest 命令行参数;而 pytest 收到显式文件路径时会绕过 pyproject.toml 的 norecursedirs(其中明确排除了 packages/loopx-ark-turn 与 packages/loopx-memt-turn),导致核心环境中缺失 arkruntime 时预检直接中断。
  2. scripts/qualify_release_commit.py — _run_shard 与 _merge_shard_durations(L508-524、L573-587、L678-686):当启用 --durations-out 时,每个分片先把用户传入的 --durations-path 完整复制到 .shard-{group}-durations.json,再以 --store-durations --durations-path=<shard_durations_file> 运行。由于未传 --clean-durations,PytestSplitCachePlugin.pytest_sessionfinish 会保留未在本分片运行的其他测试旧耗时并写回分片文件;随后 main() 按 as_completed 顺序收集文件, _merge_shard_durations 直接 merged[key] = float(value) 覆写,造成先完成分片的新耗时被后完成分片里携带的旧种子耗时反写覆盖。
  3. scripts/qualify_release_commit.py — _remove_tree_tolerant(L253-267):为只读测试产物清理准备了 handle_readonly(func, path, _exc_info) 回调,但调用 shutil.rmtree(root, onexc=handle_readonly) 使用了 Python 3.12 新增的关键字参数 onexc,而 pyproject.toml 声明 requires-python = ">=3.11" 且 CI 主测试跑在 Python 3.11;同时回调内直接 node.stat()/os.chmod() 也未像 tests/conftest.py:_make_owned_tree_removable 那样先跳过 symlink。
  4. scripts/qualify_release_commit.py — main(L611-727):在入口和结尾双次执行 _require_clean_source,通过 shard_selection_fingerprint 与 can_reuse_shard_receipt 绑定 git_commit、git_tree、git_dirty=False、分片数与筛选参数实现 fail-closed --resume,并通过 summarize_junit_xml_files 归约出 receipt-pytest.json。但 --only-preflight 仅在 if args.preflight_since: 分支内生效,若只传 --only-preflight 而不传 --preflight-since,会静默跳过预检并启动全量分片跑测。
  5. pyproject.toml(L206)与 scripts/qualify-doubao-model-behavior-live.py(L60):norecursedirs 补充 pytest 常见忽略目录模式(.*、*.egg、node_modules、venv)并保留原有排除项;--max-workers 默认值由 1 提升到 6 并保留显式 --max-workers 1 回退及现有线程锁与独立 fixture_root 隔离。

对主干的风险 / Risks

  1. [P1 阻断] 预检选取绕过 norecursedirs 导致文档化的 v2.3.0..HEAD 发版预检命令在当前 head 必挂
    • 触发条件与证据:按 docs/product/release-readiness.md 新写示例运行 python3 scripts/qualify_release_commit.py --repo-root . --output-dir <out> --preflight-since v2.3.0 --only-preflight,因 v2.3.0..HEAD 包含 packages/loopx-ark-turn/tests/test_host.py,核心 .venv 实测于 12.49s 以 exit_code=2 中断(ModuleNotFoundError: No module named 'arkruntime');对照实验排除 packages/loopx-ark-turn/ 与 packages/loopx-memt-turn/ 后,其余 534 个模块收集通过(21883 tests collected, rc=0)。
    • 最小修复:在 _is_direct_test_path / select_preflight_tests 中排除 packages/loopx-ark-turn/ 与 packages/loopx-memt-turn/(或读取 pyproject.toml norecursedirs 路径前缀),并在 tests/control_plane/test_release_commit_qualification.py 补测。
    • 复验命令:uv run --extra test python scripts/qualify_release_commit.py --repo-root . --output-dir .local/release-qualification --preflight-since v2.3.0 --only-preflight(或先 --collect-only 核对无导入错误)。
  2. [P1 阻断] --durations-path 与 --durations-out 联用时,后完成分片把先前分片的实测耗时覆盖回旧缓存
    • 触发条件与证据:在干净 2 用例测试仓库中预置 seed-durations.json(test_a=99.0, test_b=88.0),执行 --shards 2 --durations-path seed-durations.json --durations-out merged-durations.json,实测输出 merged-durations.json 仍保留陈旧值 test_a: 99.0,仅 test_b 更新为 0.00014s。若配合 --resume 跳过部分分片,已复用分片不会产生 .shard-*-durations.json,且未跳过分片也会继续写入陈旧值。
    • 最小修复:当 store_durations=True 时向 pytest-split 传入 --clean-durations(PytestSplitPlugin 在 pytest_configure 阶段读取 durations_path 后,pytest_sessionfinish 仅写出当前分片实际执行的 test_durations),并在 _merge_shard_durations 中先加载初始 durations_path(若有)再依次合并各分片实际测得耗时;补充 2 分片 --durations-path + --durations-out 回归单测。
    • 复验命令:uv run --extra test python -m pytest -q tests/control_plane/test_release_commit_qualification.py
  3. [P1 阻断] _remove_tree_tolerant 使用 Python 3.12 专属的 shutil.rmtree(..., onexc=...),在声明支持的 Python 3.11 上必然崩溃
    • 触发条件与证据:pyproject.toml 声明 requires-python = ">=3.11" 且 CI 使用 Python 3.11;使用本机 python3.11(3.11.17)直接调用 _remove_tree_tolerant 清理非空目录时立即抛出 TypeError: rmtree() got an unexpected keyword argument 'onexc'。此外清理时直接 node.stat() 未显式跳过 symlink。
    • 最小修复:按 sys.version_info >= (3, 12) 分支传入 onexc / onerror(或复刻 tests/conftest.py:_remove_temp_dir 的先删后递归赋权模式并跳过 symlink/junction)。
    • 复验命令:python3.11 -m pytest -q tests/control_plane/test_release_commit_qualification.py(或在 3.11 下直接运行清理路径回归用例)。
  4. [P2 非阻断] --only-preflight 缺少 --preflight-since 时静默退化为全量分片跑测
    • 触发条件与证据:main() 仅在 if args.preflight_since: 内检查 args.only_preflight;单传 --only-preflight 不报参数错误而直接拉起全部 --shards 全套测试。
    • 最小修复:在参数解析后显式拒绝 args.only_preflight and not args.preflight_since。

其它维度核查结论:scope_fit 方面,新增脚本已有 docs/product/release-readiness.md 的操作员调用路径与端到端单测覆盖;default_off_isolation 与 authority_semantics 与 semantic_alignment 均为 not_applicable(无新增控制面枚举、schema 或权限授予,仅复用既有 exact_release_check_receipt_v0 与 pytest_summary_v0)。本地验证汇总:pytest 3 个关联测试文件 574 passed in 32.74s (PASS)、exact-release-commit-qualification-smoke.py (PASS)、release-readiness-doc-smoke.py 含 13 个 --surface (PASS)、ruff check (PASS)、mypy 17 文件 (PASS)、check_rfc_bilingual.py (PASS)、loopx check --scan-path 6 个文件 0 错误 (PASS);--preflight-since v2.3.0 (FAIL, exit_code=2)、--durations-path+--durations-out 反事实 (FAIL)、Python 3.11 _remove_tree_tolerant (FAIL, TypeError);远程 CI 依 Goal 配置未等待。

我的整体评价 / Verdict

综合 problem_context.outcome_impact 评估:long_horizon 为 regression(scripts/qualify_release_commit.py 的 --durations-out 缓存刷新在多轮增量发版跑测中写入陈旧耗时导致后续分片失衡,且在 Python 3.11 上清理失败);user_experience 为 regression(发版维护者按 docs/product/release-readiness.md 粘贴运行 --preflight-since v2.3.0 会被可选扩展包报错阻断,--only-preflight 误省参数则会意外跑全量);visual_review 为 not_applicable(本 PR 仅涉及 CLI 工具、pytest 配置与纯文本发布文档,无前端渲染页面改动)。

observable_semantics 判定为 unintended_drift、scope_coverage 判定为 overbroad(预检选择器越界抓入 norecursedirs 排除的 packages/loopx-ark-turn/),code_volume 为 partly_avoidable(建议直接复用或对齐 tests/conftest.py:_remove_temp_dir 避免自写 onexc 分支出错),change_proportionality 为 proportionate(且机制划分本身 retain),default_off_isolation / authority_semantics / semantic_alignment 均为 not_applicable(未新增或改写控制面词汇,仅复用已有 exact_release_check_receipt_v0 / pytest_summary_v0)。残余风险集中于上述 3 个已复现的脚本执行与 Python 3.11 兼容缺陷;待修复上述问题并补齐对应单测后,可在新 head 上重跑 test_release_commit_qualification.py、--preflight-since v2.3.0 与 Python 3.11 清理校验再予放行。

English verdict: REQUEST_CHANGES on exact head 9f9c7dd: core discovery (41664 tests) and doc/static checks PASS, but scripts/qualify_release_commit.py has 3 reproducible P1 bugs (--preflight-since v2.3.0 fails collection on packages/loopx-ark-turn/tests/test_host.py, --durations-path + --durations-out overwrites fresh timings with stale copies, and _remove_tree_tolerant uses Python 3.12-only onexc= breaking declared Python 3.11 support).

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent · Gemini · Google · self_reported

Approval conclusion (author-owned PR; GitHub blocks formal self-approval)

在精确 head 9e137145b11b0415cf19b10335dbf4ab29be86ec 上完整复核了 PR #9193 全部 6 个改动文件,并独立验证了上一轮评审 #6005426166(9f9c7ddc45)指出的 3 个 P1 与 1 个 P2 问题已全部修复:核心发现保持 41,668 条测试不变,--preflight-since v2.3.0 预检、双分片同路径耗时刷新与恢复、Python 3.11 临时目录清理及参数校验均在独立测试与反事实实验下通过。

动机 / Motivation

发版维护者在执行 v2.4.0 候选提交的发版验收时,需要完成 pytest 用例发现、变更预检、全量分片跑测以及真实模型行为评估。改动前,自定义 norecursedirs 漏掉了隐藏目录与依赖目录,真实模型评估默认单并发串行耗时较长,且缺少统一的干净检出预检与分片回执归约脚本;改动后补全了排除目录、将默认并发提升至 6(保留 --max-workers 1),并由 scripts/qualify_release_commit.py 在严格绑定干净源码身份的前提下执行预检、单波并行分片、安全合并耗时缓存以及生成零本地路径的 receipt-pytest.json 回执。实测表明,基线与当前 head 的 pytest --collect-only 保持全部 41,668 条核心用例不变,--preflight-since v2.3.0..HEAD 选中 534 个模块并干净收集 21,887 条用例(exit 0),双分片同路径耗时刷新与恢复正确写出新耗时,且临时目录清理在 Python 3.11.17 下通过。本 PR 不改变核心控制面语义、不自动触发外部付费模型或发版推广,也不修改远程 CI 分支策略或替代独立的外部发布门禁。

改动思路 / Approach

将发现目录排除保留在 pyproject.toml、默认并发调整保留在 scripts/qualify-doubao-model-behavior-live.py、并将干净检出预检与单波分片编排收敛到独立脚本 scripts/qualify_release_commit.py,同时直接复用现有的源身份与回执契约、运行时清理和 CI 插件,各机制均位于最贴近调用方的现有所有权边界内且无平行状态。当前 PR 边界严格收敛在发布验收工具链、pytest 目录发现配置、对应单测与发布就绪文档,不改动核心控制面状态机、TypeScript 所有者或远程发布门槛。

flowchart TD
    A["qualify_release_commit.py (9e137145b1)"] --> B{"干净检出校验 git_dirty==false"}
    B -- "脏工作树" --> B1["FAIL-CLOSED: RuntimeError 拒绝执行"]
    B -- "仅 --only-preflight 缺 ref" --> B2["parser.error (exit 2)"]
    B -- "干净且参数合法" --> C{"--preflight-since ?"}
    C -- "指定 (如 v2.3.0)" --> D["读取 pyproject.toml norecursedirs 过滤候选测试"]
    D --> D1["534 模块 / 21,887 用例安全收集 (rc=0)"]
    C -- "跳过或预检通过" --> E["ThreadPoolExecutor 单波并行分片 (默认 2/3 CPU 上限 12)"]
    E --> F["--clean-durations + --store-durations 写分片耗时"]
    F --> G["_merge_shard_durations (仅 --resume 复用时保留种子)"]
    E --> H["_remove_tree_tolerant: 遇 OSError 跳过软/硬链接赋权后重试 (Python 3.11+)"]
Loading

基于精确 head 9e137145b11b0415cf19b10335dbf4ab29be86ec 源码与本地执行整理,仅用于说明控制流。

核查项 基线 (869de8599d) / 上版 (9f9c7ddc45) 当前 head (9e137145b1) 实测结论
核心 pytest 发现目录 缺 .*/*.egg/node_modules/venv 补齐 4 项排除,保持全部 41,668 条用例 PASS (基线 7.21s vs head 7.10s)
--preflight-since v2.3.0 9f9c7ddc45 选入 loopx-ark-turn 报 exit 2 动态读取 norecursedirs,选中 534 模块、0 越界 PASS (21,887 用例收集 rc=0)
分片耗时 --durations-out 9f9c7ddc45 无 --clean-durations 回写旧种子 每分片 --clean-durations,仅 --resume 时保留种子 PASS (同路径双分片实测仅存新耗时)
临时目录清理兼容性 9f9c7ddc45 用 onexc= 在 Python 3.11 报 TypeError OSError 后走 _make_owned_tree_removable 重试 PASS (Python 3.11.17 软/硬链接安全)
--only-preflight 缺参 9f9c7ddc45 静默退化跑全量分片 parser.error 立即返回 exit 2 PASS

具体改动 / Changes

本次基于公共分叉基线 869de8599ddf32f4cd03b32bfb0992794973f95f 共修改 6 个文件(+1242 / -4 行):生产工具与配置 3 个文件(pyproject.toml、scripts/qualify-doubao-model-behavior-live.py、scripts/qualify_release_commit.py 共 +757 / -2),测试 1 个文件(tests/control_plane/test_release_commit_qualification.py +469),文档 2 个文件(docs/product/release-readiness.md、docs/product/releases/v2.4.0.md +16 / -2),无生成文件与纯搬移。

对照文档规范 docs/product/release-readiness.md(精确修订 9e137145b11b0415cf19b10335dbf4ab29be86ec):

  • REL-QUAL-1(干净源身份校验与零本地路径 exact_release_check_receipt_v0 回执生成):implemented(经干净/脏仓反事实与 exact-release-commit-qualification-smoke.py 验证)。
  • REL-QUAL-2(--preflight-since 预检、--durations-path/--durations-out 缓存刷新与选集绑定 --resume 完整可用):implemented(534 模块 v2.3.0..HEAD 预检、双分片同路径缓存与部分恢复单测全部通过)。
  • REL-QUAL-3(核心 pytest 隔离可选包且工具链兼容 requires-python = ">=3.11"):implemented(基线/head 均为 41,668 条用例,且 Python 3.11.17 实测清理通过)。
  • REL-QUAL-4(发布文档与 v2.4.0.md 说明同步及 13 项可选能力文档 smoke):implemented(默认并发变更已公开披露,release-readiness-doc-smoke.py 全通过)。

关键代码讲解

  1. scripts/qualify_release_commit.py — select_preflight_tests(L122-176):在筛选基于 Git 差异的直跑与关联测试前,通过 _load_pytest_norecursedirs 解析 pyproject.toml 排除模式,并用 _is_excluded_by_norecursedirs 对变动路径与候选模块做目录前缀和分段模式过滤,彻底阻止 packages/loopx-ark-turn/、packages/loopx-memt-turn/ 等可选包测试绕过目录排除。
  2. scripts/qualify_release_commit.py — _run_shard(L457-572)与 _merge_shard_durations(L588-604):每个分片先复制种子耗时再附加 --clean-durations --store-durations 仅输出本分片实际测试耗时;汇总阶段仅当存在 resumed 分片时以 preserve_seed=True 保留未重跑分片的旧种子并按有序分片结果覆盖更新,随后清理 .shard-*-durations.json。
  3. scripts/qualify_release_commit.py — _remove_tree_tolerant(L242-255):移除 Python 3.12 专属的 onexc=,先以 shutil.rmtree 删除,遇到权限类 OSError 时调用 _make_owned_tree_removable(跳过 symlink/junction 及 st_nlink != 1 硬链接,仅对自有目录和单链接文件补加写权限)后重试删除,兼顾 Python 3.11 兼容与宿主安全。
  4. scripts/qualify_release_commit.py — main 参数校验与孤立环境(L258-318、L628-642):在参数解析后立即拒绝无 --preflight-since 的 --only-preflight(exit 2),并为每个子进程创建剥离宿主环境前缀及权限 0700 的 NODE_COMPILE_CACHE 隔离目录。
  5. scripts/qualify-doubao-model-behavior-live.py — _parser(L60)与 pyproject.toml(L206):将 --max-workers 默认值由 1 提升至 6(保留 --max-workers 1 显式回退和既有 threading.Lock 保护),并补全 pytest 默认排除模式。

对主干的风险 / Risks

本次复核确认上一轮评审(9f9c7ddc45)的 4 项问题在 9e137145b1 已全部修复:

  • scripts/qualify_release_commit.py 的 --preflight-since v2.3.0 预检越界(旧 P1):已在 select_preflight_tests 增加 pyproject.toml norecursedirs 过滤,v2.3.0..HEAD 3,109 个改动路径精确收敛为 534 个模块(0 个可选扩展测试),收集 21,887 条用例 rc=0。
  • --durations-path 与 --durations-out 陈旧耗时覆盖(旧 P1):已补充 --clean-durations 与 preserve_seed,在独立 2 分片同路径反事实仓库中验证更新为最新耗时(约 0.000107s / 0.000105s)且不再残留 99.0s 种子。
  • _remove_tree_tolerant 的 Python 3.11 TypeError(旧 P1):已改用 _make_owned_tree_removable 重试模式,并用本机 Python 3.11.17 实测只读树+软链接+硬链接目录清理通过且未改动外部目标权限。
  • 缺少 --preflight-since 的 --only-preflight 静默全量(旧 P2):实测直接返回 exit 2 与明确错误提示。

其他合规维度:scope_fit(verified)已有文档命令行入口与端到端测试;default_off_isolation、authority_semantics、semantic_alignment 均为 not_applicable(无隐蔽默认开关,未授予写远端/发布权限,未新增或改写控制面枚举与 exact_release_check_receipt_v0 契约);默认并发变更已同步披露于文档与测试。独立本地验证结果:

  • 关联单测与干净仓 E2E(test_release_commit_qualification.py、test_actual_default_model_behavior_live.py、test_python_ci_workflow.py):578 passed in 33.18s (PASS)
  • v2.3.0..HEAD 预检收集与 HEAD~1 --only-preflight 实跑:534 模块 21,887 用例收集 rc=0、HEAD~1 exit 0 (PASS)
  • 全仓 pytest 收集基线对比:869de8599d 与 9e137145b1 同为 41,668 tests collected (PASS)
  • Python 3.11.17 清理校验、同路径耗时合并、脏仓拒绝、--only-preflight 缺参拦截反事实:全部通过 (PASS)
  • 文档与静态检查:release-readiness-doc-smoke.py(基础 + 13 个 v2.4.0.md --surface)、exact-release-commit-qualification-smoke.py、ruff check、mypy(17 文件)、check_rfc_bilingual.py、loopx check --scan-path(6 文件 0 错):全部通过 (PASS)
  • loopx canary premerge --from-git-diff --git-diff-base origin/main:passed selected=19 failures=0 (PASS)
  • 全仓 12 分片实跑与真实 Ark API 6 并发实时请求:未在评审期间触发付费外网调用与长耗时全量重跑 (UNVERIFIED);远程 GitHub CI 依 Goal 配置未等待/未查询 (UNVERIFIED)。

我的整体评价 / Verdict

基于独立校验,本 PR 在解决发版准备与 pytest 发现瓶颈的同时,已完整修复上轮暴露的预检越界、耗时缓存覆盖、Python 3.11 兼容性及参数校验问题。problem_context.outcome_impact 评估:long_horizon 为 improved(选集绑定恢复与 --clean-durations 安全合并保障了跨轮次发版验证的可恢复性与均衡性);user_experience 为 improved(维护者按文档命令即可在 Python 3.11+ 直接执行干净检出预检与并发默认验证);visual_review 为 not_applicable:已复核全部 6 个改动文件,仅涉及脚手架配置、Python CLI 工具、单元测试与纯文本发布文档,无前端渲染界面或交互页面变化;未验证范围(unverified_scope):none。

observable_semantics 判定为 intentional_change_validated(默认 --max-workers 由 1 调至 6 及 norecursedirs 扩展已公开披露且测试保留 41,668 条核心用例并维持 --max-workers 1),scope_coverage 判定为 verified,code_volume 为 necessary(兼容性策略 retain),change_proportionality 为 proportionate 且机制边界本身为 retain,default_off_isolation / authority_semantics / semantic_alignment 均为 not_applicable(未引入新控制面词汇或协议字段,仅复用现有 exact_release_check_receipt_v0 与 pytest_summary_v0)。残余风险仅为外部付费 Ark 接口高并发限流与未重跑完整 12 分片耗时(均已保留 CLI 显式回退参数)。精确 head 9e137145b11b0415cf19b10335dbf4ab29be86ec 满足发布与合并评审标准,建议批准。

English verdict: APPROVE on exact head 9e13714: all 4 prior findings are fixed cleanly and verified locally (578 targeted/E2E tests PASS, 41,668-test collection parity PASS, v2.3.0..HEAD preflight 534-module/21,887-test collection PASS, Python 3.11.17 tolerant cleanup and same-path duration merge counterfactuals PASS, release doc & canary premerge 19/19 PASS); remaining unrun items are live external Ark calls and full 12-shard duration measurement.

@loopx-agent
loopx-agent merged commit 202d7bd into main Nov 21, 2026
13 of 15 checks passed
@loopx-agent
loopx-agent deleted the codex/perf-release-qualification-20261121 branch November 21, 2026 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant